
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/holonomic/represent.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:20 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Representation of holonomic functions in SymPy &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="represent.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Operations on holonomic functions" href="operations.html" />
    <link rel="prev" title="About Holonomic Functions" href="about.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="operations.html" title="Operations on holonomic functions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="about.html" title="About Holonomic Functions"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Holonomic</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Representation of holonomic functions in SymPy</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="representation-of-holonomic-functions-in-sympy">
<h1>Representation of holonomic functions in SymPy<a class="headerlink" href="#representation-of-holonomic-functions-in-sympy" title="Permalink to this headline">¶</a></h1>
<p>Class <a class="reference internal" href="#sympy.holonomic.holonomic.DifferentialOperator" title="sympy.holonomic.holonomic.DifferentialOperator"><code class="xref py py-class docutils literal notranslate"><span class="pre">DifferentialOperator</span></code></a> is used to represent the annihilator
but we create differential operators easily using the function
<a class="reference internal" href="#sympy.holonomic.holonomic.DifferentialOperators" title="sympy.holonomic.holonomic.DifferentialOperators"><code class="xref py py-func docutils literal notranslate"><span class="pre">DifferentialOperators()</span></code></a>. Class <a class="reference internal" href="#sympy.holonomic.holonomic.HolonomicFunction" title="sympy.holonomic.holonomic.HolonomicFunction"><code class="xref py py-class docutils literal notranslate"><span class="pre">HolonomicFunction</span></code></a> represents a holonomic function.</p>
<p>Let’s explain this with an example:</p>
<p>Take <span class="math notranslate nohighlight">\(\sin(x)\)</span> for instance, the differential equation satisfied by it
is <span class="math notranslate nohighlight">\(y^{(2)}(x) + y(x) = 0\)</span>. By definition we conclude it is a holonomic
function. The general solution of this ODE is
<span class="math notranslate nohighlight">\(C_{1} \cdot \sin(x) + C_{2} \cdot \cos(x)\)</span> but to get <span class="math notranslate nohighlight">\(\sin(x)\)</span> we need to
provide initial conditions i.e. <span class="math notranslate nohighlight">\(y(0) = 0, y^{(1)}(0) = 1\)</span>.</p>
<p>To represent the same in this module one needs to provide the differential
equation in the form of annihilator. Basically a differential operator is an
operator on functions that differentiates them. So <span class="math notranslate nohighlight">\(D^{n} \cdot y(x) = y^{(n)}(x)\)</span>
where <span class="math notranslate nohighlight">\(y^{(n)}(x)\)</span> denotes <code class="docutils literal notranslate"><span class="pre">n</span></code> times differentiation of <span class="math notranslate nohighlight">\(y(x)\)</span> with
respect to <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
<p>So the differential equation can also be written as
<span class="math notranslate nohighlight">\(D^{2} \cdot y(x) + y(x) = 0\)</span> or <span class="math notranslate nohighlight">\((D^{2} + 1) \cdot y(x) = 0\)</span>.
The part left of <span class="math notranslate nohighlight">\(y(x)\)</span> is the annihilator i.e. <span class="math notranslate nohighlight">\(D^{2}+1\)</span>.</p>
<p>So this is how one will represent <span class="math notranslate nohighlight">\(\sin(x)\)</span> as a Holonomic Function:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic</span> <span class="kn">import</span> <span class="n">DifferentialOperators</span><span class="p">,</span> <span class="n">HolonomicFunction</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">D</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="s1">&#39;D&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">D</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>
<span class="go">HolonomicFunction((1) + (1)*D**2, x, 0, [0, 1])</span>
</pre></div>
</div>
<p>The polynomial coefficients will be members of the ring <code class="docutils literal notranslate"><span class="pre">ZZ[x]</span></code> in the example.
The <code class="docutils literal notranslate"><span class="pre">D</span></code> operator returned by the function <a class="reference internal" href="#sympy.holonomic.holonomic.DifferentialOperators" title="sympy.holonomic.holonomic.DifferentialOperators"><code class="xref py py-func docutils literal notranslate"><span class="pre">DifferentialOperators()</span></code></a> can
be used to create annihilators just like SymPy expressions.
We currently use the older implementations of rings in SymPy for priority
mechanism.</p>
<section id="holonomicfunction">
<h2>HolonomicFunction<a class="headerlink" href="#holonomicfunction" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.HolonomicFunction">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.holonomic.holonomic.</span></span><span class="sig-name descname"><span class="pre">HolonomicFunction</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">annihilator</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x0</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y0</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L386-L2152"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.HolonomicFunction" title="Permalink to this definition">¶</a></dt>
<dd><p>A Holonomic Function is a solution to a linear homogeneous ordinary
differential equation with polynomial coefficients. This differential
equation can also be represented by an annihilator i.e. a Differential
Operator <code class="docutils literal notranslate"><span class="pre">L</span></code> such that <span class="math notranslate nohighlight">\(L.f = 0\)</span>. For uniqueness of these functions,
initial conditions can also be provided along with the annihilator.</p>
<p class="rubric">Explanation</p>
<p>Holonomic functions have closure properties and thus forms a ring.
Given two Holonomic Functions f and g, their sum, product,
integral and derivative is also a Holonomic Function.</p>
<p>For ordinary points initial condition should be a vector of values of
the derivatives i.e. <span class="math notranslate nohighlight">\([y(x_0), y'(x_0), y''(x_0) ... ]\)</span>.</p>
<p>For regular singular points initial conditions can also be provided in this
format:
<span class="math notranslate nohighlight">\({s0: [C_0, C_1, ...], s1: [C^1_0, C^1_1, ...], ...}\)</span>
where s0, s1, … are the roots of indicial equation and vectors
<span class="math notranslate nohighlight">\([C_0, C_1, ...], [C^0_0, C^0_1, ...], ...\)</span> are the corresponding initial
terms of the associated power series. See Examples below.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">HolonomicFunction</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">S</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">QQ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">1</span><span class="p">])</span>  <span class="c1"># e^x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">q</span> <span class="o">=</span> <span class="n">HolonomicFunction</span><span class="p">(</span><span class="n">Dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">])</span>  <span class="c1"># sin(x)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">+</span> <span class="n">q</span>  <span class="c1"># annihilator of e^x + sin(x)</span>
<span class="go">HolonomicFunction((-1) + (1)*Dx + (-1)*Dx**2 + (1)*Dx**3, x, 0, [1, 2, 1])</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">*</span> <span class="n">q</span>  <span class="c1"># annihilator of e^x * sin(x)</span>
<span class="go">HolonomicFunction((2) + (-2)*Dx + (1)*Dx**2, x, 0, [0, 1])</span>
</pre></div>
</div>
<p>An example of initial conditions for regular singular points,
the indicial equation has only one root <span class="math notranslate nohighlight">\(1/2\)</span>.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="o">-</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">Dx</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">{</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">]})</span>
<span class="go">HolonomicFunction((-1/2) + (x)*Dx, x, 0, {1/2: [1]})</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">HolonomicFunction</span><span class="p">(</span><span class="o">-</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">Dx</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="p">{</span><span class="n">S</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">]})</span><span class="o">.</span><span class="n">to_expr</span><span class="p">()</span>
<span class="go">sqrt(x)</span>
</pre></div>
</div>
<p>To plot a Holonomic Function, one can use <span class="math notranslate nohighlight">\(.evalf()\)</span> for numerical
computation. Here’s an example on <span class="math notranslate nohighlight">\(sin(x)**2/x\)</span> using numpy and matplotlib.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sympy.holonomic</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">var</span><span class="p">,</span> <span class="n">sin</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="n">var</span><span class="p">(</span><span class="s2">&quot;x&quot;</span><span class="p">)</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">sympy</span><span class="o">.</span><span class="n">holonomic</span><span class="o">.</span><span class="n">expr_to_holonomic</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="o">/</span><span class="n">x</span><span class="p">,</span> <span class="n">x0</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">evalf</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s2">&quot;holonomic function&quot;</span><span class="p">)</span> 
<span class="gp">&gt;&gt;&gt; </span><span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> 
</pre></div>
</div>
</dd></dl>

</section>
<section id="differentialoperator">
<h2>DifferentialOperator<a class="headerlink" href="#differentialoperator" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.DifferentialOperator">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.holonomic.holonomic.</span></span><span class="sig-name descname"><span class="pre">DifferentialOperator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">list_of_poly</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">parent</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L149-L383"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.DifferentialOperator" title="Permalink to this definition">¶</a></dt>
<dd><p>Differential Operators are elements of Weyl Algebra. The Operators
are defined by a list of polynomials in the base ring and the
parent ring of the Operator i.e. the algebra it belongs to.</p>
<p class="rubric">Explanation</p>
<p>Takes a list of polynomials for each power of <code class="docutils literal notranslate"><span class="pre">Dx</span></code> and the
parent ring which must be an instance of DifferentialOperatorAlgebra.</p>
<p>A Differential Operator can be created easily using
the operator <code class="docutils literal notranslate"><span class="pre">Dx</span></code>. See examples below.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">DifferentialOperator</span><span class="p">,</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">DifferentialOperator</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">],</span> <span class="n">R</span><span class="p">)</span>
<span class="go">(1)*Dx + (x**2)*Dx**2</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">Dx</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span> <span class="o">-</span> <span class="n">Dx</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
<span class="go">(2*x**2 + 2*x + 1) + (4*x**3 + 2*x**2 - 4)*Dx + (x**4 - 6*x - 2)*Dx**2 + (-2*x**2)*Dx**3 + (1)*Dx**4</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.DifferentialOperatorAlgebra" title="sympy.holonomic.holonomic.DifferentialOperatorAlgebra"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DifferentialOperatorAlgebra</span></code></a></p>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.DifferentialOperator.is_singular">
<span class="sig-name descname"><span class="pre">is_singular</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x0</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L377-L383"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.DifferentialOperator.is_singular" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks if the differential equation is singular at x0.</p>
</dd></dl>

</dd></dl>

</section>
<section id="differentialoperators">
<h2>DifferentialOperators<a class="headerlink" href="#differentialoperators" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.DifferentialOperators">
<span class="sig-prename descclassname"><span class="pre">sympy.holonomic.holonomic.</span></span><span class="sig-name descname"><span class="pre">DifferentialOperators</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">generator</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L41-L76"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.DifferentialOperators" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used to create annihilators using <code class="docutils literal notranslate"><span class="pre">Dx</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>base:</strong></p>
<blockquote>
<div><p>Base polynomial ring for the algebra.
The base polynomial ring is the ring of polynomials in <span class="math notranslate nohighlight">\(x\)</span> that
will appear as coefficients in the operators.</p>
</div></blockquote>
<p><strong>generator:</strong></p>
<blockquote>
<div><p>Generator of the algebra which can
be either a noncommutative <code class="docutils literal notranslate"><span class="pre">Symbol</span></code> or a string. e.g. “Dx” or “D”.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Explanation</p>
<p>Returns an Algebra of Differential Operators also called Weyl Algebra
and the operator for differentiation i.e. the <code class="docutils literal notranslate"><span class="pre">Dx</span></code> operator.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span>
<span class="go">Univariate Differential Operator Algebra in intermediate Dx over the base ring ZZ[x]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Dx</span><span class="o">*</span><span class="n">x</span>
<span class="go">(1) + (x)*Dx</span>
</pre></div>
</div>
</dd></dl>

</section>
<section id="differentialoperatoralgebra">
<h2>DifferentialOperatorAlgebra<a class="headerlink" href="#differentialoperatoralgebra" title="Permalink to this headline">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.holonomic.holonomic.DifferentialOperatorAlgebra">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.holonomic.holonomic.</span></span><span class="sig-name descname"><span class="pre">DifferentialOperatorAlgebra</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">base</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">generator</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/holonomic/holonomic.py#L79-L146"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.holonomic.holonomic.DifferentialOperatorAlgebra" title="Permalink to this definition">¶</a></dt>
<dd><p>An Ore Algebra is a set of noncommutative polynomials in the
intermediate <code class="docutils literal notranslate"><span class="pre">Dx</span></code> and coefficients in a base polynomial ring <span class="math notranslate nohighlight">\(A\)</span>.
It follows the commutation rule:</p>
<div class="math notranslate nohighlight">
\[Dxa = \sigma(a)Dx + \delta(a)\]</div>
<p>for <span class="math notranslate nohighlight">\(a \subset A\)</span>.</p>
<p>Where <span class="math notranslate nohighlight">\(\sigma: A \Rightarrow A\)</span> is an endomorphism and <span class="math notranslate nohighlight">\(\delta: A \rightarrow A\)</span>
is a skew-derivation i.e. <span class="math notranslate nohighlight">\(\delta(ab) = \delta(a) b + \sigma(a) \delta(b)\)</span>.</p>
<p>If one takes the sigma as identity map and delta as the standard derivation
then it becomes the algebra of Differential Operators also called
a Weyl Algebra i.e. an algebra whose elements are Differential Operators.</p>
<p>This class represents a Weyl Algebra and serves as the parent ring for
Differential Operators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">ZZ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.holonomic.holonomic</span> <span class="kn">import</span> <span class="n">DifferentialOperators</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">Dx</span> <span class="o">=</span> <span class="n">DifferentialOperators</span><span class="p">(</span><span class="n">ZZ</span><span class="o">.</span><span class="n">old_poly_ring</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="s1">&#39;Dx&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span>
<span class="go">Univariate Differential Operator Algebra in intermediate Dx over the base ring</span>
<span class="go">ZZ[x]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.holonomic.holonomic.DifferentialOperator" title="sympy.holonomic.holonomic.DifferentialOperator"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DifferentialOperator</span></code></a></p>
</div>
</dd></dl>

</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Representation of holonomic functions in SymPy</a><ul>
<li><a class="reference internal" href="#holonomicfunction">HolonomicFunction</a></li>
<li><a class="reference internal" href="#differentialoperator">DifferentialOperator</a></li>
<li><a class="reference internal" href="#differentialoperators">DifferentialOperators</a></li>
<li><a class="reference internal" href="#differentialoperatoralgebra">DifferentialOperatorAlgebra</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="about.html"
                        title="previous chapter">About Holonomic Functions</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="operations.html"
                        title="next chapter">Operations on holonomic functions</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/holonomic/represent.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="operations.html" title="Operations on holonomic functions"
             >next</a> |</li>
        <li class="right" >
          <a href="about.html" title="About Holonomic Functions"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Holonomic</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Representation of holonomic functions in SymPy</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/holonomic/represent.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:28:20 GMT -->
</html>